import { AssertTrue as Assert, IsExact } from "conditional-type-checks";
import { IsTuple } from "../lib";

function testIsTuple() {
  type cases = [
    Assert<IsExact<IsTuple<string>, never>>,
    Assert<IsExact<IsTuple<number>, never>>,
    Assert<IsExact<IsTuple<boolean>, never>>,
    Assert<IsExact<IsTuple<undefined>, never>>,
    Assert<IsExact<IsTuple<null>, never>>,
    Assert<IsExact<IsTuple<{ a: 1 }>, never>>,
    Assert<IsExact<IsTuple<[]>, []>>,
    Assert<IsExact<IsTuple<[1]>, [1]>>,
    Assert<IsExact<IsTuple<[1, 2]>, [1, 2]>>,
    Assert<IsExact<IsTuple<[1, 2, 3]>, [1, 2, 3]>>,
    Assert<IsExact<IsTuple<[1, 2, 3, 4]>, [1, 2, 3, 4]>>,
    Assert<IsExact<IsTuple<[1, 2, 3, 4, 5]>, [1, 2, 3, 4, 5]>>,
    Assert<IsExact<IsTuple<[1, 2, 3, 4, 5, 6]>, [1, 2, 3, 4, 5, 6]>>,
    Assert<IsExact<IsTuple<[1, 2, 3, 4, 5, 6, 7]>, [1, 2, 3, 4, 5, 6, 7]>>,
    Assert<IsExact<IsTuple<[1, 2, 3, 4, 5, 6, 7, 8]>, [1, 2, 3, 4, 5, 6, 7, 8]>>,
    Assert<IsExact<IsTuple<[1, 2, 3, 4, 5, 6, 7, 8, 9]>, [1, 2, 3, 4, 5, 6, 7, 8, 9]>>,
    Assert<IsExact<IsTuple<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>>,
    Assert<IsExact<IsTuple<readonly []>, readonly []>>,
    Assert<IsExact<IsTuple<readonly [1]>, readonly [1]>>,
    Assert<IsExact<IsTuple<readonly [1, 2]>, readonly [1, 2]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3]>, readonly [1, 2, 3]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3, 4]>, readonly [1, 2, 3, 4]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3, 4, 5]>, readonly [1, 2, 3, 4, 5]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3, 4, 5, 6]>, readonly [1, 2, 3, 4, 5, 6]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3, 4, 5, 6, 7]>, readonly [1, 2, 3, 4, 5, 6, 7]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3, 4, 5, 6, 7, 8]>, readonly [1, 2, 3, 4, 5, 6, 7, 8]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3, 4, 5, 6, 7, 8, 9]>, readonly [1, 2, 3, 4, 5, 6, 7, 8, 9]>>,
    Assert<IsExact<IsTuple<readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>, readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>>,
    Assert<IsExact<IsTuple<number[]>, never>>,
    Assert<IsExact<IsTuple<readonly number[]>, never>>,
    Assert<IsExact<IsTuple<Array<number>>, never>>,
    Assert<IsExact<IsTuple<ReadonlyArray<number>>, never>>,
    Assert<IsExact<IsTuple<{ length: 3 }>, never>>,
    Assert<IsExact<IsTuple<[1, 2?, 3?]>, [1, 2?, 3?]>>,
    Assert<IsExact<IsTuple<[1?, 2?, 3?]>, [1?, 2?, 3?]>>,
    Assert<IsExact<IsTuple<[1, 2, ...number[]]>, [1, 2, ...number[]]>>,
    Assert<IsExact<IsTuple<[1, 2?, ...number[]]>, [1, 2?, ...number[]]>>,
    Assert<IsExact<IsTuple<[1?, 2?, ...number[]]>, [1?, 2?, ...number[]]>>,
    Assert<IsExact<IsTuple<[number?, ...number[]]>, [number?, ...number[]]>>,
    Assert<IsExact<IsTuple<[1, 2, ...number[], 3, 4]>, [1, 2, ...number[], 3, 4]>>,
    Assert<IsExact<IsTuple<[...number[], 1, 2]>, [...number[], 1, 2]>>,
    Assert<IsExact<IsTuple<any[]>, never>>,
    Assert<IsExact<IsTuple<never[]>, never>>,
    Assert<IsExact<IsTuple<[any]>, [any]>>,
    Assert<IsExact<IsTuple<[never]>, [never]>>,
  ];
}
